css: Remove _gtk_css_style_property_changes_affect_size()
authorBenjamin Otte <otte@redhat.com>
Tue, 27 Jan 2015 04:03:52 +0000 (05:03 +0100)
committerBenjamin Otte <otte@redhat.com>
Tue, 27 Jan 2015 04:04:34 +0000 (05:04 +0100)
... and _gtk_css_style_property_changes_affect_font().

Replace it with _gtk_css_style_property_get_mask_affecting().

gtk/gtkcssstyleproperty.c
gtk/gtkcssstylepropertyprivate.h
gtk/gtktextview.c
gtk/gtktreeview.c
gtk/gtkwidget.c

index 55da7d17de9eea1938f84f80c53f03b0f9cf1842..9f6dca23f2db171f4e7e1277f9ef34fa56e4503a 100644 (file)
@@ -47,9 +47,6 @@ enum {
 
 G_DEFINE_TYPE (GtkCssStyleProperty, _gtk_css_style_property, GTK_TYPE_STYLE_PROPERTY)
 
-static GtkBitmask *_properties_affecting_size = NULL;
-static GtkBitmask *_properties_affecting_font = NULL;
-
 static GtkCssStylePropertyClass *gtk_css_style_property_class = NULL;
 
 static void
@@ -61,12 +58,6 @@ gtk_css_style_property_constructed (GObject *object)
   property->id = klass->style_properties->len;
   g_ptr_array_add (klass->style_properties, property);
 
-  if (property->affects & (GTK_CSS_AFFECTS_SIZE | GTK_CSS_AFFECTS_CLIP))
-    _properties_affecting_size = _gtk_bitmask_set (_properties_affecting_size, property->id, TRUE);
-
-  if (property->affects & GTK_CSS_AFFECTS_FONT)
-    _properties_affecting_font = _gtk_bitmask_set (_properties_affecting_font, property->id, TRUE);
-
   G_OBJECT_CLASS (_gtk_css_style_property_parent_class)->constructed (object);
 }
 
@@ -253,9 +244,6 @@ _gtk_css_style_property_class_init (GtkCssStylePropertyClass *klass)
 
   klass->style_properties = g_ptr_array_new ();
 
-  _properties_affecting_size = _gtk_bitmask_new ();
-  _properties_affecting_font = _gtk_bitmask_new ();
-
   gtk_css_style_property_class = klass;
 }
 
@@ -435,14 +423,3 @@ _gtk_css_style_property_get_mask_affecting (GtkCssAffects affects)
   return result;
 }
 
-gboolean
-_gtk_css_style_property_changes_affect_size (const GtkBitmask *changes)
-{
-  return _gtk_bitmask_intersects (changes, _properties_affecting_size);
-}
-
-gboolean
-_gtk_css_style_property_changes_affect_font (const GtkBitmask *changes)
-{
-  return _gtk_bitmask_intersects (changes, _properties_affecting_font);
-}
index fbc84897497da3058122b87f8f9b1002400ce906..2dbe6ed9fb6bdcb8ef965b84add9363a9d1199c9 100644 (file)
@@ -85,10 +85,6 @@ void                    _gtk_css_style_property_print_value     (GtkCssStyleProp
 
 GtkBitmask *            _gtk_css_style_property_get_mask_affecting
                                                                 (GtkCssAffects           affects);
-gboolean                _gtk_css_style_property_changes_affect_size
-                                                                (const GtkBitmask       *changes);
-gboolean                _gtk_css_style_property_changes_affect_font
-                                                                (const GtkBitmask       *changes);
 
 G_END_DECLS
 
index cdf7503e109fe4e11584b3f53b2d147dbc7519d0..6d0777cc16fc30ddd9709e1d3e480098352b83a6 100644 (file)
@@ -4454,12 +4454,16 @@ gtk_text_view_set_background (GtkTextView *text_view)
 static void
 gtk_text_view_style_updated (GtkWidget *widget)
 {
+  static GtkBitmask *affects_font = NULL;
   GtkTextView *text_view;
   GtkTextViewPrivate *priv;
   PangoContext *ltr_context, *rtl_context;
   GtkStyleContext *style_context;
   const GtkBitmask *changes;
 
+  if (G_UNLIKELY (affects_font) == NULL)
+    affects_font = _gtk_css_style_property_get_mask_affecting (GTK_CSS_AFFECTS_FONT);
+
   text_view = GTK_TEXT_VIEW (widget);
   priv = text_view->priv;
 
@@ -4473,7 +4477,8 @@ gtk_text_view_style_updated (GtkWidget *widget)
 
   style_context = gtk_widget_get_style_context (widget);
   changes = _gtk_style_context_get_changes (style_context);
-  if ((changes == NULL || _gtk_css_style_property_changes_affect_font (changes)) &&
+
+  if ((changes == NULL || _gtk_bitmask_intersects (changes, affects_font)) &&
       priv->layout && priv->layout->default_style)
     {
       gtk_text_view_set_attributes_from_style (text_view,
index 2c79b620a51f5d1f159638f638edf52d1589bb36..3a7355dc483c1519caa4591b9ecefe027377a6d8 100644 (file)
@@ -8700,12 +8700,16 @@ gtk_tree_view_grab_focus (GtkWidget *widget)
 static void
 gtk_tree_view_style_updated (GtkWidget *widget)
 {
+  static GtkBitmask *affects_size = NULL;
   GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
   GList *list;
   GtkTreeViewColumn *column;
   GtkStyleContext *style_context;
   const GtkBitmask *changes;
 
+  if (G_UNLIKELY (affects_size) == NULL)
+    affects_size = _gtk_css_style_property_get_mask_affecting (GTK_CSS_AFFECTS_SIZE | GTK_CSS_AFFECTS_CLIP);
+
   GTK_WIDGET_CLASS (gtk_tree_view_parent_class)->style_updated (widget);
 
   if (gtk_widget_get_realized (widget))
@@ -8718,7 +8722,8 @@ gtk_tree_view_style_updated (GtkWidget *widget)
 
   style_context = gtk_widget_get_style_context (widget);
   changes = _gtk_style_context_get_changes (style_context);
-  if (changes == NULL || _gtk_css_style_property_changes_affect_size (changes))
+
+  if (changes == NULL || _gtk_bitmask_intersects (changes, affects_size))
     {
       for (list = tree_view->priv->columns; list; list = list->next)
        {
index 980e457eef8e8e7448079c41291500839e337c37..b7fa3670a5ad0c03c56ee9942e4639d066b28644 100644 (file)
@@ -8229,7 +8229,12 @@ gtk_widget_real_style_updated (GtkWidget *widget)
 
       if (widget->priv->anchored)
         {
-          if (changes == NULL || _gtk_css_style_property_changes_affect_size (changes))
+          static GtkBitmask *affects_size = NULL;
+
+          if (G_UNLIKELY (affects_size) == NULL)
+            affects_size = _gtk_css_style_property_get_mask_affecting (GTK_CSS_AFFECTS_SIZE | GTK_CSS_AFFECTS_CLIP);
+
+          if (changes == NULL || _gtk_bitmask_intersects (changes, affects_size))
             gtk_widget_queue_resize (widget);
           else
             gtk_widget_queue_draw (widget);